﻿using AutoMapper;
using JXC.Application.Dtos;
using JXC.Core.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace JXC.WebAPI.Profiles
{
    public class CaigouOrderDetailProfile :Profile
    {
        public CaigouOrderDetailProfile()
        {
            CreateMap<CaiGouOrderDetail, CaigouOrderDetail>()
                .ForMember(dest => dest.CommodityInformationSheetName,
                opt => { opt.MapFrom(src => src.CommodityInformationSheet.ProductName); })
                .ForMember(dest => dest.BuyDate,
                opt => { opt.MapFrom(src => src.CaigouOrder.OrderDate); })
                .ForMember(dest => dest.BuyDate,
                opt => { opt.MapFrom(src => src.CaigouOrder.OrderDate); })
                  .ForMember(dest => dest.PurchasingAgentId,
                opt => { opt.MapFrom(src => src.CaigouOrder.UserInfosId); })
                     .ForMember(dest => dest.Monetary,
                opt => { opt.MapFrom(src => src.CaigouOrder.Monetary); });


            CreateMap<CaigouOrderDetail, CaiGouOrderDetail>()
                .ForMember(dest=>dest.UintPrice, opt => { opt.MapFrom(src => src.unitPrice); })
                ;
        }
    }
}
